package cn.mcartoon.serviceImpl;
import cn.mcartoon.mapper.MmRechargeDicMapper;
import cn.mcartoon.pojo.MmRechargeDic;
import cn.mcartoon.service.MmRechargeDicService;
import cn.mcartoon.dto.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
@Service
public class MmRechargeDicServiceImpl implements MmRechargeDicService {

    @Autowired
    private MmRechargeDicMapper mmRechargeDicMapper;

    public MmRechargeDic getMmRechargeDicById(Long id){
        return mmRechargeDicMapper.getMmRechargeDicById(id);
    }

    public List<MmRechargeDic>	getMmRechargeDicListByMap(Map<String,Object> param){
        return mmRechargeDicMapper.getMmRechargeDicListByMap(param);
    }

    public Integer getMmRechargeDicCountByMap(Map<String,Object> param){
        return mmRechargeDicMapper.getMmRechargeDicCountByMap(param);
    }

    public Integer insertMmRechargeDic(MmRechargeDic mmRechargeDic){
            return mmRechargeDicMapper.insertMmRechargeDic(mmRechargeDic);
    }

    public Integer updateMmRechargeDic(MmRechargeDic mmRechargeDic){
        return mmRechargeDicMapper.updateMmRechargeDic(mmRechargeDic);
    }

    public Integer deleteMmRechargeDicById(Long id){
        return mmRechargeDicMapper.deleteMmRechargeDicById(id);
    }

    public Integer batchDeleteMmRechargeDic(String ids){
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return mmRechargeDicMapper.batchDeleteMmRechargeDic(param);
    }

    public Page<MmRechargeDic> queryMmRechargeDicPageByMap(Map<String,Object> param,Integer pageNo,Integer pageSize){
        Integer total = mmRechargeDicMapper.getMmRechargeDicCountByMap(param);
        Page page = new Page(pageNo, pageSize, total);
        param.put("beginPos", page.getBeginPos());
        param.put("pageSize", page.getPageSize());
        List<MmRechargeDic> mmRechargeDicList = mmRechargeDicMapper.getMmRechargeDicListByMap(param);
        page.setList(mmRechargeDicList);
        return page;
     }


}
